<!--需要的变量$data,$category_list,$model_fields-->
{if isset($model_fields) && is_array($model_fields)}
{foreach name="model_fields" key="key" id="v" index="i"}
{if $v.field_name == "media_title" && $v.checked == "1"}
<div class="form-group">
    <label class="col-sm-3 control-label">{$v.field_alias}</label>
    <div class="col-sm-3">
        <input type="hidden" name="{$v.field_name}_desc" value="{$v.field_alias}">
        <input type="hidden" name="{$v.field_name}_checked" value="{$v.checked}">
        <input class="form-control" name="{$v.field_name}" value="{$data[$v.field_name]}" required>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
{elseif $v.field_name == "meida_img" && $v.checked == "1"}
<div class="form-group">
    <label class="col-sm-3 control-label">{$v.field_alias}</label>
    <!--KindEditor 图片上传预览部分 单个图片-->
    <div class="col-sm-9">
        <input type="hidden" name="{$v.field_name}_desc" value="{$v.field_alias}">
        <input type="hidden" name="{$v.field_name}_checked" value="{$v.checked}">
        <div class="s-div-img-preview" style="display:{if $data[$v.field_name]} block;{else}none;{/if}">
            <div class="s-div-img-item">
                <img src="{$data[$v.field_name]}" id="{$v.field_name}_img">
                <i class="fa fa-times" aria-hidden="true" iele="close"></i>
                <input type="hidden" id="{$v.field_name}" name="{$v.field_name}"  value="{$data[$v.field_name]}">
            </div>
        </div>
        <div class="s-div-img-upload">
            <input type="button" class="btn btn-default" id="{$v.field_name}_image_up_btn" value="选择图片">
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            /*单张图片*/
            var iele = $("i[iele='close']").one("click",function () {
                var input_url = $("#{$v.field_name}");
                var img = $("#{$v.field_name}_img");
                var img_preview = img.parent().parent();

                input_url.val("");
                img.attr("src","");
                img_preview.hide();
                iele.unbind("click");
            });
            KE.K('#{$v.field_name}_image_up_btn').click(function() {
                KE.editor.loadPlugin('image', function() {
                    KE.editor.plugin.imageDialog({
                        imageUrl : "",
                        clickFn : function(url, title, width, height, border, align) {
                            var input_url = KE.K("#{$v.field_name}");
                            input_url.val(url);
                            var img = KE.K("#{$v.field_name}_img");
                            img.attr("src",url);
                            var img_preview = img.parent().parent();
                            img_preview.show();
                            var img_item = $(".s-div-img-item>i", img_preview);
                            img_item.unbind("click");
                            img_item.on("click",function (e) {
                                input_url.val("");
                                img.attr("src","");
                                $(this.parentNode.parentNode).hide();
                            });
                            KE.editor.hideDialog();
                        }
                    });
                });
            });
        });
    </script>
</div>
{elseif $v.field_name == "media_desc" && $v.checked == "1"}
<div class="form-group">
    <label class="col-sm-3 control-label">{$v.field_alias}</label>
    <div class="col-sm-3">
        <input type="hidden" name="{$v.field_name}_desc" value="{$v.field_alias}">
        <input type="hidden" name="{$v.field_name}_checked" value="{$v.checked}">
        <textarea class="form-control" name="{$v.field_name}" rows="8" placeholder="200字内">{$data[$v.field_name]|raw}</textarea>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
{elseif $v.field_name == "media_content" && $v.checked == "1"}
<div class="form-group">
    <label class="col-sm-3 control-label">{$v.field_alias}</label>
    <div class="col-sm-7">
        <input type="hidden" name="{$v.field_name}_desc" value="{$v.field_alias}">
        <input type="hidden" name="{$v.field_name}_checked" value="{$v.checked}">
        <textarea name="{$v.field_name}" id="{$v.field_name}{$i}" style="width: 700px;">{$data[$v.field_name]}</textarea>
    </div>
    <script type="text/javascript">
        $(function () {
            create_KE("#{$v.field_name}{$i}",{height:800,filterMode:"off"});
        });
    </script>
</div>
{elseif $v.field_name == "media_order" && $v.checked == "1"}
<div class="form-group">
    <label class="col-sm-3 control-label">{$v.field_alias}</label>
    <div class="col-sm-3">
        <input type="hidden" name="{$v.field_name}_desc" value="{$v.field_alias}">
        <input type="hidden" name="{$v.field_name}_checked" value="{$v.checked}">
        <input type="number" class="form-control" name="{$v.field_name}" value="{$data[$v.field_name]|raw}" required>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
{elseif $v.field_name == "media_recom" && $v.checked == "1"}
<div class="form-group">
    <label class="col-sm-3 control-label">{$v.field_alias}</label>
    <div class="col-sm-3">
        <input type="hidden" name="{$v.field_name}_desc" value="{$v.field_alias}">
        <input type="hidden" name="{$v.field_name}_checked" value="{$v.checked}">
        <label class="s-label-radio">
            <input type="radio" name="{$v.field_name}" value="0" id="{$v.field_name}0" {if in_array($data[$v.field_name],[0])} checked {/if}>
            <label for="{$v.field_name}0" class="fa fa-check"></label>不推荐
        </label>
        <label class="s-label-radio">
            <input type="radio" name="{$v.field_name}" value="1" id="{$v.field_name}1" {if in_array($data[$v.field_name],[1])} checked {/if}>
            <label for="{$v.field_name}1" class="fa fa-check"></label>推荐到首页
        </label>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
{elseif $v.field_name == "media_model_id" && $v.checked == "1"}
<div class="form-group" style="display: none;">
    <label class="col-sm-3 control-label">{$v.field_alias}</label>
    <div class="col-sm-3">
        <input type="hidden" name="{$v.field_name}_desc" value="{$v.field_alias}">
        <input type="hidden" name="{$v.field_name}_checked" value="{$v.checked}">
        <input type="text" class="form-control" name="{$v.field_name}" value="{$data[$v.field_name]|raw}" readonly>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
{elseif $v.field_name == "media_member_id" && $v.checked == "1"}
<div class="form-group" style="display: none;">
    <label class="col-sm-3 control-label">{$v.field_alias}</label>
    <div class="col-sm-3">
        <input type="hidden" name="{$v.field_name}_desc" value="{$v.field_alias}">
        <input type="hidden" name="{$v.field_name}_checked" value="{$v.checked}">
        <input type="text" class="form-control" name="{$v.field_name}" value="{$data[$v.field_name]|raw}" readonly>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
{elseif $v.field_name == "media_category_id" &&  in_array($v.checked,[0,1])}
<div class="form-group">
    <label class="col-sm-3 control-label">{$v.field_alias}</label>
    <div class="col-sm-3">
        <select class="form-control" name="{$v.field_name}">
            <option value="0">{$Think.lang.select}</option>
            {foreach name="$category_list" key="k" id="val" index="j"}
            <option value="{$val.cate_id}" {if in_array($val.cate_id,[$data[$v.field_name]])} selected{/if}>{$val.cate_name}</option>
            {/foreach}
        </select>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
{elseif $v.field_name == "medis_ext_field" && $v.checked == "1"}
{/if}
{/foreach}
{/if}